﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Alteração Cadastro Cliente</title>
<?php include "menu.inc"?>
</head>

<body >
<!-- ************************************************************************ -->
<!-- Formlario Alteração -->
<br />
<br />
<form name="form" action="../negocio/Ecommerce.php" method="post"><input
	type="hidden" name="operacao" value="atualizarc"></input>
<table border="0" cellpadding="2" cellspacing="1" align="center">


	<?php
	include_once '../negocio/Conexao.php';
	$nome = $_POST['nome'];

	try {
		if($nome != null){
			$conexao = new Conexao();
			$sql = $conexao->prepare("SELECT * FROM cliente2 where nome = ?");
			$sql->bindValue(1, $nome);
			$sql->execute();
			$res = $sql->fetchObject();
			if($res != null){

				
?>

	<th bgcolor="#0099FF" colspan="2" align="center">Atualizar Cadastro Cliente</th>
	
	
	<tr>
		<td></td>
		<td><input type="hidden" name="id_cliente" value="<?php echo $res->id_cliente?>">
		</input></td>
	</tr>
	

	<tr>
		<td>Nome :</td>
		<td><input type="text" name="nome" value="<?php echo $res->nome ?>">
		</input></td>
	</tr>
	<tr>
		<td>Idade :</td>
		<td><input type="text" name="idade" maxlength="3" value="<?php echo $res->idade ?>">
		</input></td>
	</tr>

	<tr>
		<td>CPF :</td>
		<td><input type="text" name="cpf" maxlength="11" value="<?php echo $res->cpf ?>"> </input></td>
	</tr>

	<tr>
	
		<td>Sexo :</td>
		<td>
		Masculino<input type="radio" name="sexo"  checked="checked" value="<?php echo ($res->sexo) ?>" ></input>
		Feminino<input	type="radio" name="sexo"  checked="checked" value="<?php echo ($res->sexo) ?>"></input>
		</td>
	</tr>

	<tr>
		<td>Email :</td>
		<td><input type="text" name="email" value="<?php echo $res->email ?>">
		</input></td>
	</tr>

	<tr>
		<td>Telefone :</td>
		<td><input type="text" name="telefone" maxlength="10"
			value="<?php echo $res->telefone ?>"> </input></td>
	</tr>

	<tr>
		<td>Cep :</td>
		<td><input type="text" name="cep" maxlength="8" value="<?php echo $res->cep ?>"> </input></td>
	</tr>
	
	<tr>
		<td>Numero	:</td>
		<td><input type="text" name="numero" maxlength="8" value="<?php echo $res->numero ?>"> </input></td>
	</tr>
	
	<tr>
		<td>Bairro :</td>
		<td><input type="text" name="bairro" value="<?php echo $res->bairro ?>"></input></td>
	</tr>
	
	<tr>
		<td>Cidade :</td>
		<td><input type="text" name="cidade" value="<?php echo $res->cidade ?>"></input></td>
	</tr>
	
	
	<tr>
		<td>Estado :</td>
		<td><input type="text" name="estado" value="<?php echo $res->estado ?>"></input></td>
	</tr>

	<tr>
		<td>Logradouro :</td>
		<td><input type="text" name="logradouro" value="<?php echo $res->logradouro ?>"> </input></td>
	</tr>


	<tr align="center">
		<td colspan="2"><input type="submit" name="botaoAtualizar" value="Atualizar"></input>		
		</td>
	</tr>

</table>
</form>


				<?php
			}
		}else
		{
			echo "<center><i>Escolha um produto e digite o nome!</i></center>";
		}

	} catch (PDOException $pdo) {
		throw new ErrorBanco($pdo->getMessage(), $pdo->getCode());
	}

	?>

</body>
</html>
